 
<template>
  <div class="login">
    <input type="text" v-model="username" placeholder="请输入用户名">
    <input type="password" v-model="password" placeholder="请输入密码">
    <button @click="login">登录</button>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    login() {
      // 发送登录请求
      // 验证成功后，保存用户信息到本地，然后跳转到主界面
      uni.setStorageSync('userInfo', { username: this.username })
      uni.switchTab({ url: '/pages/home/home' })
    }
  }
}
</script>